FROM ubuntu:20.04

ENV TZ=Asia/Shanghai
ENV LANG=zh_CN.UTF-8

WORKDIR /zhenxun_bot

COPY pip.conf /root/.pip/pip.conf
COPY requirements.txt /zhenxun_bot/requirements.txt

RUN set -ex \
    && sed -i 's/ports.ubuntu.com/mirrors.aliyun.com/g' /etc/apt/sources.list \
    && apt-get update && apt upgrade -y \
    && DEBIAN_FRONTEND="noninteractive" apt-get install -y tzdata \
    && apt-get install -y python3 python3-pip python3-dev vim language-pack-zh-hans ca-certificates \
    && apt-get install -y ffmpeg gcc g++ make libxml2-dev libxslt-dev libffi-dev gfortran libopenblas-dev liblapack-dev libatlas-base-dev libblas-dev \
    && ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone \
    && pip install --upgrade pip \
    && pip install --ignore-installed -r requirements.txt \
    && pip install emoji wordcloud playwright \
    && rm -rf ~/.cache/pip/* \
    && playwright install chromium \
    && playwright install-deps chromium \
    && apt -y autoremove \
    && rm -rf /var/cache/apt/* && rm -rf /tmp/*

CMD [ "python3", "bot.py" ]
